package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.pojo.StuCount;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RequestMapping("/report")
@RestController
public class ReportController {

    @Autowired
    private ReportService reportService;

    //统计员工职位人数
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("统计员工职位人数");
        JobOption jobOption = reportService.getJobData();
        return Result.success(jobOption);
    }

    //统计员工性别
    @GetMapping("/empGenderData")
    public Result getEmpGender(){
        log.info("统计员工性别");
        List<Map<String,Object>> genderList = reportService.getEmpGender();
        return Result.success(genderList);
    }

    //统计学员学历
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        log.info("统计学员学历");
        List<Map<String,Object>> stuDegreeData = reportService.getStudentDegreeData();
        return Result.success(stuDegreeData);
    }

    //班级人数统计
    @GetMapping("/studentCountData")
    public Result studentCountData(){
        log.info("班级人数统计");
        StuCount stuCount = reportService.getStuCount();
        return Result.success(stuCount);
    }
}
